$(document).scroll(function(){
	$.get("index.json",function(data){
		var html = "";
		var flag = true;
		$.each(data,function(i,o){
			html +=	"<div class=\"h-special-item h-round h-hover js-special-item  item_soldout\">"
						+"<div class=\"main_pro_while h-special-p\" style=\"margin: 0;position: relative;\">"
									+"<i class=\"brand_soldout\">抢光了</i>"
									+"<a href=\"javascript:;\" class=\"h-a h-fill\">"
										+"<img class=\"h-fill lazyload\" data-original=\""+o.img+"\" style=\"display:inline;\">"
									+"</a>"
								+"</div>"
								+"<div class=\"h-special-detail\">"
									+"<div class=\"h-special-title\">"
									+"<div class=\"h-special-time\">距结束<span class=\"h-special-interval\"><span>0天</span><strong>0时</strong><strong>0分</strong><strong>0秒</strong></span></div>"
										+"<img class=\"h-special-flag\" src=\"img/21_100x100.png\">"
										+"<span class=\"h-special-tt wide\">韩国直采杭州保税仓发货</span>"
									+"</div>"
									+"<p class=\"h-special-text\">"
										+"<a href=\"#\" style=\"color: inherit\">"+o.specialText+"</a>"
									+"</p>"
					+"<p class=\"h-special-desc\">"+o.specialDesc+"</p>"
									+"<div class=\"h-special-b\">"
										+"<a href=\"#\" class=\"h-special-btn\">立即抢购</a>"
										+"<div class=\"h-special-price\">￥<span class=\"h-special-num\">"+o.num+"</span>"
											+"<span class=\"h-special-price2\">￥"+o.price+"</span>"
										+"</div>"
									+"</div>"
								+"</div>"
							+"</div>"
		});	
		$("#recommendListCon").html(html);
	//被卷页面的高度
	var $sHeight = $(document).scrollTop();
	//网页可视高度
	console.log($sHeight);
	var $kHeight = $(window).height();
	//整个页面的高度
	console.log($kHeight);
	var $dHeight = $(document).height();
	console.log($dHeight);
	if($sHeight>=$dHeight-$kHeight){
		
		$.get("index1.json",function(data){
		var html1 = "";
		var flag = true;
		$.each(data,function(i,o){
			html1 +=	"<div class=\"h-special-item h-round h-hover js-special-item  item_soldout\">"
						+"<div class=\"main_pro_while h-special-p\" style=\"margin: 0;position: relative;\">"
									+"<i class=\"brand_soldout\">抢光了</i>"
									+"<a href=\"goodsContent.html\" class=\"h-a h-fill\">"
										+"<img class=\"h-fill lazyload\" data-original=\""+o.img+"\" style=\"display:inline;\">"
									+"</a>"
								+"</div>"
								+"<div class=\"h-special-detail\">"
									+"<div class=\"h-special-title\">"
									+"<div class=\"h-special-time\">距结束<span class=\"h-special-interval\"><span>0天</span><strong>0时</strong><strong>0分</strong><strong>0秒</strong></span></div>"
										+"<img class=\"h-special-flag\" src=\"img/21_100x100.png\">"
										+"<span class=\"h-special-tt wide\">韩国直采杭州保税仓发货</span>"
									+"</div>"
									+"<p class=\"h-special-text\">"
										+"<a href=\"#\" style=\"color: inherit\">"+o.specialText+"</a>"
									+"</p>"
					+"<p class=\"h-special-desc\">"+o.specialDesc+"</p>"
									+"<div class=\"h-special-b\">"
										+"<a href=\"#\" class=\"h-special-btn\">立即抢购</a>"
										+"<div class=\"h-special-price\">￥<span class=\"h-special-num\">"+o.num+"</span>"
											+"<span class=\"h-special-price2\">￥"+o.price+"</span>"
										+"</div>"
									+"</div>"
								+"</div>"
							+"</div>"
		});	
		html1 += html;
		$("#recommendListCon").html(html1);
		$("img").lazyload({
			effect:"fadeIn",
			threshold:20,
			placeholder:"img/TB1fkyVJpXXXXbbXpXX7WcCNVXX-400-400.png"
			});
	  });
	}
		$("#recommendListCon>.h-special-item>.h-special-p>i:not(:first)").css("display","none");
		$("#siftbtn").click(function(){
			if(flag){
				flag = false;
				$("#siftbtn>img").attr("src","img/TB1xYW8LFXXXXaQXVXXYSJgFpXX-20-20.gif");
				$("#siftMenu").css("display","block").animate({opacity:1},600);
			}else{
				$("#siftbtn>img").attr("src","img/TB1R8O7LFXXXXXUXVXX1DxgFpXX-20-20.png");
				$("#siftMenu").css("display","none").animate({opacity:0},600);
				flag = true;
			}
		})
		$("img").lazyload({
			effect:"fadeIn",
			threshold:20,
			placeholder:"img/TB1fkyVJpXXXXbbXpXX7WcCNVXX-400-400.png"
			});
		});
		$(".h-other-hot-box>.h-other-hot").mouseenter(function(){
			var $index = $(this).index();
			$(".js-limit:eq("+$index+")").css("display","block");
		});
		$(".h-other-hot-box>.h-other-hot").mouseleave(function(){
			var $index = $(this).index();
			$(".js-limit:eq("+$index+")").css("display","none");
		});
});

/*$(document).scroll(function(){
	//被卷页面的高度
	var $sHeight = $(document).scrollTop();
	//网页可视高度
	var $kHeight = $(window).height();
	//整个页面的高度
	var $dHeight = $(document).height();
	if($sHeight+$kHeight==$dHeight){
		
	}
});*/
$(window).on('beforeunload',function(){
	return "主人~确定要离开页面么？";
});
